<?php
    // Connexion à la base SQL
    $mysqli = new mysqli('localhost', 'root', 'root', 'forum');
?>

<?php
	if (isset($_GET['idSuj']))
	{
        $id_sujet = $_GET['idSuj'];
        $requete = 'SELECT login FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND id_message = ' . $sujet . ';';
        $result = $mysqli->query($requete);
        $array = $result->fetch_assoc();
        echo "<p>Utilisateur : " . $array['login'] . "</p>";

        $id_sujet = $_GET['idSuj'];
        $requete = 'SELECT COUNT(*) AS aff FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND login = ' . $requete . ';';
        $result = $mysqli->query($requete);
        $array = $result->fetch_assoc();
        echo "<p>Messages : " . $array['aff'] . "</p>";

        $id_sujet = $_GET['idSuj'];
        $requete = 'SELECT dateInscription FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND id_message = ' . $sujet . ';';
        $result = $mysqli->query($requete);
        $array = $result->fetch_assoc();
        echo "<p>Date d'inscription : " . $array['dateInscription'] . "</p>";

        $id_sujet = $_GET['idSuj'];
        $requete = 'SELECT date_message FROM message WHERE id_message = ' . $sujet . ';';
        $result = $mysqli->query($requete);
        $array = $result->fetch_assoc();
        echo "<p>Date du message : " . $array['date_message'] . "</p>";
    }
?>


    <?php

                         $mysqli = new mysqli('localhost', 'root', 'root', 'forum');
                        if (isset($_GET['idSuj']))
                            {
                                $id_sujet = $_GET['idSuj'];
                                $requete = 'SELECT login FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND id_message = ' . $sujet . ';';
                                $result = $mysqli->query($requete);
                                $array = $result->fetch_assoc();
                                echo "<p>Utilisateur : " . $array['login'] . "</p>";

                                $id_sujet = $_GET['idSuj'];
                                $requete = 'SELECT COUNT(*) AS aff FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND login = ' . $requete . ';';
                                $result = $mysqli->query($requete);
                                $array = $result->fetch_assoc();
                                echo "<p>Messages : " . $array['aff'] . "</p>";

                                $id_sujet = $_GET['idSuj'];
                                $requete = 'SELECT dateInscription FROM message,sujet WHERE message.id_sujet = sujet.id_sujet AND id_message = ' . $sujet . ';';
                                $result = $mysqli->query($requete);
                                $array = $result->fetch_assoc();
                                echo "<p>Date d'inscription : " . $array['dateInscription'] . "</p>";

                                $id_sujet = $_GET['idSuj'];
                                $requete = 'SELECT date_message FROM message WHERE id_message = ' . $sujet . ';';
                                $result = $mysqli->query($requete);
                                $array = $result->fetch_assoc();
                                echo "<p>Date du message : " . $array['date_message'] . "</p>";
                            }
                        ?>